package com.hp.btc.bean;

import java.util.HashMap;
import java.util.Map;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;

import org.codehaus.jackson.annotate.JsonIgnore;


public class BeanServiceVDN implements Comparable{

	private String id;
	private String idDescription;
	@NotNull
	private String serviceHour;
	@NotNull
	private String vdn;
	@NotNull
	private String vdnOutHour;
	@Min(value=1)
	@Max(value=6)
	private Integer rate=0;
	private String status;
	private String audioNameServHours;
	private String audioNameOutServHours;
	private Boolean outHour = false;
	private Integer count = 0;

	private BeanVDN beanVDN;
	private BeanVDN beanVDNOutHour;
	
	private BeanAudio beanAudioHourService;
	private BeanAudio beanAudioOutHourService;
	
	private String sendTextToAudit; 
	
	@JsonIgnore
	public Boolean getOutHour() {
		return outHour;
	}
	public void setOutHour(Boolean outHour) {
		this.outHour = outHour;
	}
	public String getAudioNameServHours() {
		return audioNameServHours;
	}
	public void setAudioNameServHours(String audioNameServHours) {
		this.audioNameServHours = audioNameServHours;
	}
	public String getAudioNameOutServHours() {
		return audioNameOutServHours;
	}
	public void setAudioNameOutServHours(String audioNameOutServHours) {
		this.audioNameOutServHours = audioNameOutServHours;
	}
	@JsonIgnore
	public Integer getCount() {
		return count;
	}
	public void setCount(Integer count) {
		this.count = count;
	}
	public String getVdnOutHour() {
		return vdnOutHour;
	}
	public void setVdnOutHour(String vdnOutHour) {
		this.vdnOutHour = vdnOutHour;
	}
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getVdn() {
		return vdn;
	}
	public void setVdn(String vdn) {
		this.vdn = vdn;
	}
	public String getServiceHour() {
		return serviceHour;
	}
	public void setServiceHour(String serviceHour) {
		this.serviceHour = serviceHour;
	}
	public Integer getRate() {
		return rate;
	}
	public void setRate(Integer rate) {
		this.rate = rate;
	}
	public String getStatus() {
		return status;
	}
	public void setStatus(String status) {
		this.status = status;
	}
	@JsonIgnore
	public String getIdDescription() {
		return idDescription;
	}
	public void setIdDescription(String idDescription) {
		this.idDescription = idDescription;
	}
	@JsonIgnore
	public BeanVDN getBeanVDN() {
		return beanVDN;
	}
	public void setBeanVDN(BeanVDN beanVDN) {
		this.beanVDN = beanVDN;
	}
	@JsonIgnore
	public BeanVDN getBeanVDNOutHour() {
		return beanVDNOutHour;
	}
	public void setBeanVDNOutHour(BeanVDN beanVDNOutHour) {
		this.beanVDNOutHour = beanVDNOutHour;
	}
	
	public void setSendTextToAudit(String hourServiceText) {
		StringBuilder builder = new StringBuilder();
		Map<String, String>map =new HashMap<String, String>();
		map.put("enabled", "ON");
		map.put("disabled", "OFF");
		if (status != null)
			builder.append("VIGENCIA ").append(map.get(status)).append("|");
		if (beanVDN != null)
			builder.append("VDN ").append(beanVDN.getValue()).append("|");
		if (beanVDNOutHour != null)
			builder.append("VDNOUTHOUR ").append(beanVDNOutHour.getValue()).append("|");
		if (rate != null)
			builder.append("PONDERACION ").append(rate).append("|");
		builder.append(hourServiceText);
		this.sendTextToAudit = builder.toString();
	}
	
	@JsonIgnore
	public String getSendTextToAudit(){
		return sendTextToAudit;
	}
	
	public int compareTo(Object arg0) {
		
		BeanServiceVDN serviceVDN = (BeanServiceVDN)arg0;   
	    return serviceVDN.getRate().compareTo(this.rate); 
		 
	}
	
	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("BeanServiceVDN [");
		if (id != null)
			builder.append("id=").append(id).append(", ");
		if (idDescription != null)
			builder.append("idDescription=").append(idDescription).append(", ");
		if (serviceHour != null)
			builder.append("serviceHour=").append(serviceHour).append(", ");
		if (vdn != null)
			builder.append("vdn=").append(vdn).append(", ");
		if (vdnOutHour != null)
			builder.append("vdnOutHour=").append(vdnOutHour).append(", ");
		if (rate != null)
			builder.append("rate=").append(rate).append(", ");
		if (status != null)
			builder.append("status=").append(status).append(", ");
		if (audioNameServHours != null)
			builder.append("audioNameServHours=").append(audioNameServHours)
					.append(", ");
		if (audioNameOutServHours != null)
			builder.append("audioNameOutServHours=")
					.append(audioNameOutServHours).append(", ");
		if (count != null)
			builder.append("count=").append(count).append(", ");
		if (sendTextToAudit != null)
			builder.append("sendTextToAudit=").append(sendTextToAudit);
		builder.append("]");
		return builder.toString();
	}
	@JsonIgnore
	public BeanAudio getBeanAudioHourService() {
		return beanAudioHourService;
	}
	public void setBeanAudioHourService(BeanAudio beanAudioHourService) {
		this.beanAudioHourService = beanAudioHourService;
	}
	@JsonIgnore
	public BeanAudio getBeanAudioOutHourService() {
		return beanAudioOutHourService;
	}
	public void setBeanAudioOutHourService(BeanAudio beanAudioOutHourService) {
		this.beanAudioOutHourService = beanAudioOutHourService;
	}
	
}
